package filter;

import javax.servlet.*;
import java.io.IOException;

/**
 *
 * ServletDemo1进行转发index.jsp，进行测试
 *
 * @author Mc.Chai
 * @program: JavaWeb
 * @create 2022-04-07-21:07 21:07
 */
/**浏览器直接请求index.jsp,该过滤器被执行*/
//@WebFilter(value = "/index.jsp",dispatcherTypes = DispatcherType.REQUEST)
/**浏览器转发index.jsp,该过滤器被执行*/
//@WebFilter(value = "/index.jsp",dispatcherTypes = DispatcherType.FORWARD)
/**浏览器转发或者请求index.jsp,该过滤器都会执行*/
//@WebFilter(value = "/index.jsp",dispatcherTypes = {DispatcherType.REQUEST,DispatcherType.FORWARD})
public class FilterDemo2 implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("doFilter...");
    }

    @Override
    public void destroy() {

    }
}
